﻿@using CNav.Support
@model IEnumerable<CNav.Domain.Admin.FormDesign>

@{
    ViewBag.Title = "Form Design";
}
@if (@Model.Any())
{
    <div>
        Form Name :  @Html.DisplayFor(modelItem => Model.First().FormName)
    </div>
}
<div>
    <table id="box-table-a">
        <tr>
            <th>Control
            </th>
            <th>
                Control Name
            </th>
            <th>
               Label / Caption
            </th>
            <th>
               Display Order
            </th>
            <th>
               Data List
            </th>
            <th>Action</th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.ControlType)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ControlName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LabelText)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.DisplayOrder)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.DataSourceName)
                </td>
                <td>
                    @Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
                    @Html.ActionLink("Details", "Details", new { id = item.ID }) |
                    @Html.ActionLink("Delete", "Delete", new { id = item.ID })
                </td>
            </tr>
        }

    </table>
    <ol>
          <li class="liCentre">
            <input type="button" value="Add" id="createNew" />
              <input type="button" value="View" id="btnView" />
             <input type="button" value="Cancel" id="cancelButton" />
        </li>
    </ol>
</div>

<script type="text/javascript">
    $(document).ready(function () {

        var cc = new CaseCentre();
        cc.BindButton("#createNew", '@Url.Content("~/FormDesign/Create")');
        cc.BindCancel('#cancelButton', '@Url.Content("~/CustomForm/Index")');
        cc.BindCancel('#btnView', '@Url.Content("~/Render?formId=")' + '@Session[Constant.FormId]');
        
    });
</script>
